<?php
// +---------------------------------------------------------------------+
// | OneBase    | [ WE CAN DO IT JUST THINK ]                            |
// +---------------------------------------------------------------------+
// | Licensed   | http://www.apache.org/licenses/LICENSE-2.0 )           |
// +---------------------------------------------------------------------+
// | Author     | Bigotry <3162875@qq.com>                               |
// +---------------------------------------------------------------------+
// | Repository | https://gitee.com/Bigotry/OneBase                      |
// +---------------------------------------------------------------------+

namespace app\admin\controller;




/**
下注记录 */
class BetsLog extends AdminBase
{

    /**
     *  用户下注记录列表
     */
    public function BetsLogList()
    {

        $where = $this->logicBetsLog->getWhere($this->param);
        $this->assign('list', $this->logicBetsLog->getBetsLogList($where, 'a.*,c.name as category_name,m.username', 'a.create_time desc'));
        $this->assign('cate',\app\common\model\Lottery::all(['status'=>1]));
        $this->assign('param',$this->param);
        return $this->fetch('bets_log_list');
    }



    /**
     *  用户下注记录添加
     */
    public function BetsLogAdd()
    {

        $this->BetsLogCommon();
        $this->assign('cate',\app\common\model\Lottery::all(['status'=>1]));
        return $this->fetch('bets_log_edit');
    }

    /**
     *  用户下注记录编辑
     */
    public function BetsLogEdit()
    {

        $this->BetsLogCommon();

        $info = $this->logicBetsLog->getBetsLogInfo(['a.id' => $this->param['id']], 'a.*,c.name as category_name');

        $this->assign('cate',LotteryType::all(['status'=>1]));
        $this->assign('info', $info);

        return $this->fetch('bets_log_edit');
    }








    /**
     *  用户下注记录添加与编辑通用方法
     */
    public function BetsLogCommon()
    {

        IS_POST && $this->jump($this->logicBetsLog->BetsLogEdit($_POST));
        $this->assign('param',  $this->param);
    }






    /**
     * 数据状态设置
     */
    public function setStatus()
    {

        $this->jump($this->logicAdminBase->setStatus('BetsLog', $this->param));
    }


    /**
     * 数据状态设置
     */
    public function update_info()
    {
        $this->jump($this->logicBetsLog->update_info($this->param));
    }




}
